{extends file="../acp.html"}
{block name="title"}{$head_title}{/block}
{block name="content"}
<form id="J_FormArticle" action="" method="post">
    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>头衔名称：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="title_name" id="title_name" value="{$info.title_name}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>颜色：</label>
        <div class="form-controls">
            <!-- <input type="text" id="picker" name="color" > -->
            <span id="picker" class='color-box'></span>
            <input type="hidden" name='color' value="{$info.color}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <!--wangtao 2017.9.15 -start-->

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>头衔分成：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge"  style="width: 50px;" name="title_rates" id="title_rates" value="{$info.title_rates}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>
    <!--wangtao 2017.9.15 -end-->

    <div class="formitems inline">
        <label class="fi-name">
            <span class="colorRed">*</span>头衔类型：</label>
        <div class="form-controls">
            <select name="type" onchange="checkType()" {if $act == 'edit'} disabled {/if}>
                <!--<option value="">&#45;&#45;请选择&#45;&#45;</option>-->
                {foreach from=$title_type_list item=this key = key}
                <option value="{$key}" {if $info.type == $key}selected{/if}>{$this}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error"></span>
        </div>
    </div>

    <!--wangtao 2017.9.15 -start-->

    <div class="formitems inline">
        <label class="fi-name">
            <span class="colorRed">*</span>显示支付接口：</label>
        <div class="form-controls">
            <div class="radio-group">
                <label><input type="radio" name="title_post_cash" value="1" {if $info.title_post_cash == 1}checked="checked"{/if} />是</label>
                <label><input type="radio" name="title_post_cash" value="0" {if $info.title_post_cash == 0}checked="checked"{/if} />否</label>
            </div>
        </div>
    </div>
    <!--wangtao 2017.9.15 -end-->

    <div id="isOrdinary">
        <div class="formitems inline">
            <label class="fi-name">
                <span class="colorRed">*</span>普通头衔标签：</label>
            <div class="form-controls">
                <select name="tag_id" {if $act == 'edit'} disabled {/if}>
                    <option value="0">--请选择--</option>
                    {foreach from=$ordinary_tag_list item=this key =key}
                    <option value="{$key}" {if $info.tag_id == $key}selected{/if}>{$this}</option>
                    {/foreach}
                </select>
                <span class="fi-help-text error"></span>
            </div>
        </div>

        <div class="formitems inline">
            <label class="fi-name"><span class="colorRed">*</span>升级所需次数：</label>
            <div class="form-controls">
                <input type="text" placeholder="" class="xlarge" name="rank_up_num" id="rank_up_num" value="{$info.rank_up_num}">
                <span class="fi-help-text hide"></span>
            </div>
        </div>
    </div>

    <!--wangtao 2017.9.19 -strat-->
    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>升级条件：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="translate" id="translate" value="{$info.translate}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <!--wangtao 2017.9.19 -end-->

    <div id="isAppraiser" style="display: none;">
    <div class="formitems inline">
        <label class="fi-name">
            <span class="colorRed">*</span>鉴定师有权限的频道：</label>
        <div class="form-controls">
            <select name="channel_id">
                <option value="0">--请选择--</option>
                {foreach from=$channel_list item=this }
                <option value="{$this.channel_id}" {if $info.channel_id == $this.channel_id}selected{/if}>{$this.channel_name}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error"></span>
        </div>
    </div>
    </div>

    <!--<div class="formitems inline">
        <label class="fi-name">显示：</label>
        <div class="form-controls">
            <div class="radio-group">
                <label><input type="radio" name="isuse" value="1" {if $info.isuse == 1}checked="checked"{/if} />是</label>
                <label><input type="radio" name="isuse" value="0" {if $info.isuse == 0}checked="checked"{/if} />否</label>
            </div>
        </div>
    </div>-->

<!--<div class="formitems inline">
    <label class="fi-name">是否在首页显示：</label>
    <div class="form-controls">
        <div class="radio-group">
            <label><input type="radio" name="is_index" value="1" {if $info.is_index == 1}checked="checked"{/if} />是</label>
            <label><input type="radio" name="is_index" value="0" {if $info.is_index == 0}checked="checked"{/if} />否</label>
        </div>
    </div>
</div>-->


<div class="formitems inline">
    <label class="fi-name"></label>
    <div class="form-controls">
        <input type="hidden" name="act" value="{$act}" />
        <input type="hidden" name="title_id" value="{$info.title_id}" />
        <button type="submit" class="btn btn-blue submit_btn"><i class="gicon-check white"></i>保存</button>
    </div>
</div>
</form>
{/block}
{block name="css"}
<link rel="stylesheet" type="text/css" href="/Public/Css/acp/AcpTitle/colpick.css" />
<style>
    .color-box {
        float:left;
        width:30px;
        height:30px;
        margin:5px;
        border: 1px solid black;
        /*background-color: #ff8800;*/
    }
</style>
{/block}
{block name="js"}
<script type="text/javascript" src="/Public/Js/acp/AcpTitle/colpick.js"></script>
<script>

    $('.submit_btn').on('click',function () {

        $("select[name='type']").attr("disabled",false);
        $("select[name='tag_id']").attr("disabled",false);

    })



    $(function(){

        $('.color-box').css('background-color', '{$info.color}')
        $('.color-box').colpick({
            colorScheme:'dark',
            layout:'rgbhex',
            color:'{$info.color}',
            onSubmit:function(hsb,hex,rgb,el) {
                $(el).css('background-color', '#'+hex);
                $(el).colpickHide();
                $('[name=color]').val('#'+hex);
            }
        })

        var selectValue = $("select[name='type']").val();
        if (selectValue == 1) { //普通头衔
            $("#isOrdinary").show();
            $("#isAppraiser").hide();
        }
        if (selectValue == 2) { //特殊头衔
            $("#isAppraiser").hide();
            $("#isOrdinary").hide();
        }
        if (selectValue == 3) { //鉴定师
            $("#isOrdinary").hide();
            $("#isAppraiser").show();
        }
    })


    function checkType() {
        var selectValue = $("select[name='type']").val();
        if (selectValue == 1) { //普通头衔
            $("#isOrdinary").show();
            $("#isAppraiser").hide();
            $("select[name='channel_id']").val(0);
        }
        if (selectValue == 2) { //特殊头衔
            $("#isAppraiser").hide();
            $("#isOrdinary").hide();
            $('#rank_up_num').val('');
            $("select[name='channel_id']").val(0);
            $("select[name='tag_id']").val(0);
        }
        if (selectValue == 3) { //鉴定师
            $("#isOrdinary").hide();
            $("#isAppraiser").show();
            $('#rank_up_num').val('');
            $("select[name='tag_id']").val(0);
        }
    }


</script>
{/block}